--
-- Author: shunguo.chen
-- Date: 2017-01-09 16:20:20
--

local GameDB = import(".GameDB")


function GameDB:queryEquips()
	local equip = self:getCachedValues("equip2")
	return equip
end

-- 新装备格子强化属性加成 + 消耗表
function GameDB:getEquipRridEnhanceConfByStrengthenLevel( lv )
	local confTemp = self:getCachedValue( "equip_grid_enhance", lv )
	return confTemp
end

-- return c++对象
function GameDB:getEquipConf(equipId)
    return self:getCachedValue("equip2",equipId)
end

function GameDB:getEquipResConf(equipId)
    local equipResConfig = self:getCachedValue("equip_res",equipId)
    return equipResConfig
end

function GameDB:getEquipPosDefIcon(pos)
	if pos < 0 or pos > 13 then
		assert(false, "unKnown equip location")
	end
	return "art/bag_icon/equip_" .. pos .. ".png"
end

function GameDB:queryEquipSuitById( suitId )
	local equipSuit = self:getCachedValue("equip_suit",suitId)
	return equipSuit
end

function GameDB:isEquipClassAvatarEnable(equipId, classId)
	local resConf = self:getEquipResConf(equipId)
	-- if has avatar
	if resConf.part1 then 
		local conf = self:getEquipConf(equipId)
		local classStr = conf.class
		-- if class ok
		if classStr == "0" or string.isContain(classStr, classId) then
			return true
		end
	end

	return false
end

function GameDB:getEquipPosName(pos)
	local str
	if pos == 1 then
		str = L("lua_code_text_367")
	elseif pos == 2 then
		str = L("lua_code_text_242")
	elseif pos == 3 then
		str = L("lua_code_text_295")
	elseif pos == 4 then
		str = L("lua_code_text_409")
	elseif pos == 5 then
		str = L("lua_code_text_264")
	elseif pos == 6 then
		str = L("lua_code_text_512")
	elseif pos == 7 then
		str = L("lua_code_text_260")
	elseif pos == 8 then
		str = L("lua_code_text_26")
	elseif pos == 9 then
		str = L("lua_code_text_260")
	elseif pos == 10 then
		str = L("lua_code_text_257")
	elseif pos == 11 then
		str = L("lua_code_text_141")
	elseif pos == 12 then
		str = L("lua_code_text_86")
	else
		assert(false, "unKnown equip location")
	end
	return L(str, pos)
end

return GameDB
